package com.ciaojian.bytedance.controller;

import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ciaojian.bytedance.service.ByteDanceOrderService;
import com.ciaojian.core.bytedance.ByteDanceMiniConfig;
import com.ciaojian.core.bytedance.ByteDancePayConfig;
import com.ciaojian.core.bytedance.ByteDanceSignUtil;
import com.ciaojian.core.mapper.DyOrderMapper;
import com.ciaojian.core.mapper.DyUserMapper;
import com.ciaojian.core.mapper.UserMapper;
import com.ciaojian.core.model.DyUser;
import com.ciaojian.core.model.User;
import com.ciaojian.core.model.dy.DyOrder;
import com.ciaojian.core.util.Result;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@ApiModel("抖音订单接口")
@Slf4j
@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private ByteDanceOrderService byteDanceOrderService;

    @ApiOperation("查看抖音订单  潮剪数据库")
    @GetMapping("/get")
    public Result getOrders(@ApiParam("用户抖音openid") @RequestParam String openId) throws Exception {
        return byteDanceOrderService.getOrders(openId);
    }



    @ApiOperation("订单详情")
    @GetMapping("/query_order")
    public JSONObject queryOrder(@ApiParam("订单id") String orderId) throws Exception {
        return byteDanceOrderService.queryOrder(orderId);

    }

    @ApiOperation("查看抖音订单券码")
    @GetMapping("/query_item_order_info")
    public JSONObject query_item_order_info(@ApiParam("订单id") String orderId) throws Exception {
        return byteDanceOrderService.query_item_order_info(orderId);

    }
}
